<?php
/**
 * S3云存储插件 - 配置示例文件
 * 
 * @package CommonCloudStorage
 * @author xiaogg
 * @version 1.0
 */

// 防止直接访问
if (!defined('ZBP_PATH')) {
    exit('Access denied');
}

/**
 * 各大云服务商配置示例
 */

// 腾讯云COS配置示例
$tencentCOS = array(
    'storage_type' => 'AWS',
    'access_key' => 'your-secret-id',
    'secret_key' => 'your-secret-key',
    'bucket_name' => 'your-bucket-name',
    'bucket_domain' => 'your-bucket-name.cos.ap-beijing.myqcloud.com',
    'custom_domain' => 'https://your-custom-domain.com',
    'region' => 'ap-beijing'
);

// 阿里云OSS配置示例
$aliyunOSS = array(
    'storage_type' => 'AWS',
    'access_key' => 'your-access-key-id',
    'secret_key' => 'your-access-key-secret',
    'bucket_name' => 'your-bucket-name',
    'bucket_domain' => 'your-bucket-name.oss-cn-hangzhou.aliyuncs.com',
    'custom_domain' => 'https://your-custom-domain.com',
    'region' => 'oss-cn-hangzhou'
);

// 华为云OBS配置示例
$huaweiOBS = array(
    'storage_type' => 'AWS',
    'access_key' => 'your-access-key',
    'secret_key' => 'your-secret-key',
    'bucket_name' => 'your-bucket-name',
    'bucket_domain' => 'your-bucket-name.obs.cn-north-1.myhuaweicloud.com',
    'custom_domain' => 'https://your-custom-domain.com',
    'region' => 'cn-north-1'
);

// 百度云BOS配置示例
$baiduBOS = array(
    'storage_type' => 'AWS',
    'access_key' => 'your-access-key-id',
    'secret_key' => 'your-secret-access-key',
    'bucket_name' => 'your-bucket-name',
    'bucket_domain' => 'your-bucket-name.bj.bcebos.com',
    'custom_domain' => 'https://your-custom-domain.com',
    'region' => 'bj'
);

// 七牛云配置示例
$qiniuCloud = array(
    'storage_type' => 'AWS',
    'access_key' => 'your-access-key',
    'secret_key' => 'your-secret-key',
    'bucket_name' => 'your-bucket-name',
    'bucket_domain' => 'your-bucket-name.your-region.qiniucs.com',
    'custom_domain' => 'https://your-custom-domain.com',
    'region' => 'z0' // 华东
);

// 又拍云配置示例
$upyunCloud = array(
    'storage_type' => 'AWS',
    'access_key' => 'your-operator-name',
    'secret_key' => 'your-operator-password',
    'bucket_name' => 'your-service-name',
    'bucket_domain' => 'your-service-name.b0.upaiyun.com',
    'custom_domain' => 'https://your-custom-domain.com',
    'region' => 'v0' // 华东
);

// AWS S3配置示例
$awsS3 = array(
    'storage_type' => 'AWS',
    'access_key' => 'your-access-key-id',
    'secret_key' => 'your-secret-access-key',
    'bucket_name' => 'your-bucket-name',
    'bucket_domain' => 'your-bucket-name.s3.us-east-1.amazonaws.com',
    'custom_domain' => 'https://your-custom-domain.com',
    'region' => 'us-east-1'
);

// FTP配置示例
$ftpConfig = array(
    'storage_type' => 'FTP',
    'access_key' => 'ftp-username',
    'secret_key' => 'ftp-password',
    'bucket_name' => '192.168.1.100:21', // FTP服务器IP:端口
    'bucket_domain' => '', // FTP模式下留空
    'custom_domain' => 'https://your-ftp-domain.com',
    'region' => '' // FTP模式下不需要
);

/**
 * 常用区域代码参考
 */
$regionCodes = array(
    // 腾讯云COS区域
    'tencent' => array(
        'ap-beijing' => '北京',
        'ap-shanghai' => '上海',
        'ap-guangzhou' => '广州',
        'ap-chengdu' => '成都',
        'ap-chongqing' => '重庆',
        'ap-shenzhen-fsi' => '深圳金融',
        'ap-shanghai-fsi' => '上海金融',
        'ap-beijing-fsi' => '北京金融'
    ),
    
    // 阿里云OSS区域
    'aliyun' => array(
        'oss-cn-hangzhou' => '华东1（杭州）',
        'oss-cn-shanghai' => '华东2（上海）',
        'oss-cn-qingdao' => '华北1（青岛）',
        'oss-cn-beijing' => '华北2（北京）',
        'oss-cn-zhangjiakou' => '华北3（张家口）',
        'oss-cn-huhehaote' => '华北5（呼和浩特）',
        'oss-cn-shenzhen' => '华南1（深圳）',
        'oss-cn-guangzhou' => '华南2（广州）'
    ),
    
    // 华为云OBS区域
    'huawei' => array(
        'cn-north-1' => '华北-北京一',
        'cn-north-4' => '华北-北京四',
        'cn-east-2' => '华东-上海二',
        'cn-east-3' => '华东-上海一',
        'cn-south-1' => '华南-广州',
        'cn-southwest-2' => '西南-贵阳一'
    ),
    
    // AWS S3区域
    'aws' => array(
        'us-east-1' => '美国东部（弗吉尼亚北部）',
        'us-east-2' => '美国东部（俄亥俄）',
        'us-west-1' => '美国西部（加利福尼亚北部）',
        'us-west-2' => '美国西部（俄勒冈）',
        'ap-southeast-1' => '亚太地区（新加坡）',
        'ap-northeast-1' => '亚太地区（东京）'
    )
);

/**
 * 获取预设配置
 */
function CommonCloudStorage_GetPresetConfig($provider) {
    switch ($provider) {
        case 'tencent':
            return $GLOBALS['tencentCOS'];
        case 'aliyun':
            return $GLOBALS['aliyunOSS'];
        case 'huawei':
            return $GLOBALS['huaweiOBS'];
        case 'baidu':
            return $GLOBALS['baiduBOS'];
        case 'qiniu':
            return $GLOBALS['qiniuCloud'];
        case 'upyun':
            return $GLOBALS['upyunCloud'];
        case 'aws':
            return $GLOBALS['awsS3'];
        case 'ftp':
            return $GLOBALS['ftpConfig'];
        default:
            return array();
    }
}

?>